package org.example.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.example.pojo.Order;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface OrderMapper {
    //查询全部订单
    List<Order> selectOrders();
    //查询全部已发货的订单
    List<Order> selectOrdersFaHuo();
    //查询全部已下单的订单
    List<Order> selectOrdersIng();
    //查询全部已取消的订单
    List<Order> selectOrdersCancel();

    //查询该order_id的订单
    Order selectOrderByID(@Param("order_id")Integer order_id);
    //查询该order_id的已发货的订单
    Order selectOrderByOrderIDFaHuo(@Param("order_id")Integer order_id);
    //查询该order_id的已下单的订单
    Order selectOrderByOrderIDIng(@Param("order_id")Integer order_id);
    //查询该order_id的已取消的订单
    Order selectOrderByOrderIDCancel(@Param("order_id")Integer order_id);

    //查询该用户id的所有订单
    List<Order> selectOrderByUserID(@Param("user_id")Integer user_id);

    //查询该用户的全部已发货的订单
    List<Order> selectUserOrdersFaHuo(@Param("user_id")Integer user_id);
    //查询该用户的全部已下单的订单
    List<Order> selectUserOrdersIng(@Param("user_id")Integer user_id);
    //查询该用户的全部已取消的订单
    List<Order> selectUserOrdersCancel(@Param("user_id")Integer user_id);

    //查询该该用户的某order_id的已发货的订单
    Order selectUserOrderByOrderIDFaHuo(@Param("user_id")Integer user_id,@Param("order_id")Integer order_id);
    //查询该用户的某order_id的已下单的订单
    Order selectUserOrderByOrderIDIng(@Param("user_id")Integer user_id,@Param("order_id")Integer order_id);
    //查询该用户的某order_id的已取消的订单
    Order selectUserOrderByOrderIDCancel(@Param("user_id")Integer user_id,@Param("order_id")Integer order_id);
    //添加订单
    int insertOrder(Order order);
    //修改订单
    int updateOrder(Order order);
    //删除订单
    int deleteOrder(@Param("order_id")Integer id);
}
